package com.example.keli.ui.userinfo.person;

import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.keli.R;
import com.example.keli.base.BaseActivity;
import com.example.keli.base.utils.GlideUtil;
import com.example.keli.base.utils.StatusBarUtil;
import com.example.keli.base.widget.glide.BlurTransformation;
import com.flyco.roundview.RoundLinearLayout;
import com.flyco.roundview.RoundTextView;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * description $desc$
 * created by jerry on 2019/6/6.
 */
public class UserInfoActivity extends BaseActivity {

    @BindView(R.id.iv_header_bg)
    ImageView ivHeaderBg;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.iv_more)
    ImageView ivMore;
    @BindView(R.id.iv_avatar)
    ImageView ivAvatar;
    @BindView(R.id.tv_rank)
    RoundTextView tvRank;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_verify)
    RoundTextView tvVerify;
    @BindView(R.id.tv_sign)
    TextView tvSign;
    @BindView(R.id.tv_friend)
    TextView tvFriend;
    @BindView(R.id.tv_wechat)
    RoundTextView tvWechat;
    @BindView(R.id.tv_city)
    TextView tvCity;
    @BindView(R.id.tv_age)
    TextView tvAge;
    @BindView(R.id.tv_edu)
    TextView tvEdu;
    @BindView(R.id.tv_height)
    TextView tvHeight;
    @BindView(R.id.tv_size)
    TextView tvSize;
    @BindView(R.id.tv_job)
    TextView tvJob;
    @BindView(R.id.flowlayout)
    TagFlowLayout flowlayout;
    @BindView(R.id.ll_tags)
    RoundLinearLayout llTags;
    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;
    private ArrayList<String> tags = new ArrayList<>();

    @Override
    protected int layoutId() {
        StatusBarUtil.setTranslucentForImageView(this, 0, null);
        return R.layout.activity_userinfo;
    }

    @Override
    protected void bindData() {
        GlideUtil.displayTransform(this,
                ivHeaderBg,
                "https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1559720563&di=a4bdcbaf7c45f162d2cb3ee0fa4a57f6&src=http://img3.duitang.com/uploads/item/201502/20/20150220235727_MLT5j.jpeg",
                new BlurTransformation(this, 10));
        GlideUtil.displayCircle(this, ivAvatar, "https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1559720563&di=a4bdcbaf7c45f162d2cb3ee0fa4a57f6&src=http://img3.duitang.com/uploads/item/201502/20/20150220235727_MLT5j.jpeg");
        for (int i = 0; i < 80; i++) {
            tags.add("哈哈" + i);
        }
        setAdapter(flowlayout);

    }


    private void setAdapter(final TagFlowLayout tagFlowLayout) {
        final TagAdapter<String> tagAdapter = new TagAdapter<String>(tags) {
            @Override
            public View getView(FlowLayout parent, int position, String tag) {
                TextView tvTag = (TextView) LayoutInflater.from(UserInfoActivity.this).inflate(R.layout.tag_area, tagFlowLayout, false);
                tvTag.setText(tag);
                return tvTag;
            }
        };
        tagFlowLayout.setAdapter(tagAdapter);
    }

    @OnClick({R.id.iv_back, R.id.iv_more, R.id.tv_friend, R.id.tv_wechat})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                break;
            case R.id.iv_more:
                break;
            case R.id.tv_friend:
                break;
            case R.id.tv_wechat:
                break;
        }
    }
}
